﻿<%@ Page Title="Ultimate Vacation Experience CMS :: Travel Package" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="TravelPackage.aspx.cs" Inherits="TravelSite.Api.Admin.TravelPackagePage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $("#divDialog").dialog({ autoOpen: false, width: 900, resizable: false });
            $("#divDialog").parent().appendTo(jQuery("form:first"));

            $(".ui-dialog-titlebar").hide();

            <%=this.JsCodeToRunOnReady%>;
        });

        function createUpdateForm(id) {
            __doPostBack('upDetails', id);
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
            <div class="page_header">
                <h2><img src="<%=ResolveClientUrl("~") %>images/design/dashboard_icon.png" alt="" title="" /> Travel Packages</h2>
            </div>
            
            <asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
            
        	<div class="page_container">
                <asp:Button CssClass="btn apps_btn apps_gray_btn" ID="btnAdd" Text="Add New" runat="server" OnClientClick="createUpdateForm(-1); return false;" />

                <div class="table-responsive">

                <asp:GridView ID="grid" AutoGenerateColumns="false" runat="server" CssClass="table table-bordered table-hover"
                AllowPaging="True" PageSize="20" OnPageIndexChanging="grid_PageIndexChanging" onrowdatabound="grid_RowDataBound">
                <PagerSettings Mode="Numeric" PageButtonCount="4" NextPageText=">" PreviousPageText="<"  FirstPageText="<<" LastPageText=">>"/>
                <Columns>
                    <asp:TemplateField HeaderText="Package Name">
                        <ItemTemplate>
                            <asp:HiddenField ID="hidId" Value='<%#Eval("PackageId")%>' runat="server" />
                            <asp:HyperLink runat="server" ID="hlPackageName" Text='<%# Eval("PackageName") %>'/>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Vacation Length" ItemStyle-HorizontalAlign="Right">
                        <ItemTemplate>
                            <asp:Label ID="lblVacationLenght" Text='<%# Eval("VacationLength") %>' runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Cost" ItemStyle-HorizontalAlign="Right">
                        <ItemTemplate>
                            <asp:Label ID="lblCost" Text='<%# Eval("CostText") %>' runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                                        
                    <asp:TemplateField HeaderText="Action">
                        <ItemTemplate>
                            <a href='javascript:void(0)' onclick="javascript:createUpdateForm(<%#Eval("PackageId")%>);">
                                <img src="<%=ResolveClientUrl("~") %>images/design/actions_icon/edit_icon.png" alt="" title="Edit" border="0" />
                            </a>
                            <asp:ImageButton runat="server" ImageUrl="~/images/design/actions_icon/delete_icon.gif" ToolTip="Delete" Style="vertical-align:middle;"
                                ID="lbtnDelete" OnCommand="grid_RowCommand" CommandName="delete" CommandArgument='<%# Eval("PackageId")%>' OnClientClick="return confirm('Please confirm if you want to delete this package')" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                </asp:GridView>
                </div>
            </div>

            </ContentTemplate>
                <Triggers>
                </Triggers>
            </asp:UpdatePanel>

            <div id="divDialog" class="row">
                <asp:UpdatePanel runat="server" ID="upDetails" OnLoad="upDetails_Load" UpdateMode="Conditional" ClientIDMode="Static">
                <ContentTemplate>
                    <div class="fieldset_block col-lg-9 page_area" style="width:100%;">
                        <fieldset>
                            <legend><h4><asp:Label runat="server" ID="lblDialogTitle"></asp:Label></h4></legend>
                            <div class="fieldset_cotent form-horizontal">
                                <asp:Label runat="server" ID="hdId" style="display:none;" />
                                <div class="row">
                                	<div class="col-lg-12">                                    
                                    	<div class="form-group">
                                        	<label class="col-lg-4 control-label">Package Name</label>
                                            <div class="col-lg-8">
                                                <asp:TextBox CssClass="form-control" placeholder="Package Name" ID="txtPackageName" ValidationGroup="newItem" runat="server" TabIndex="1" />
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="txtPackageName" runat="server" Text="*" ValidationGroup="newItem" ForeColor="Red" />
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtPackageName" Text="Max 100 symbol lenght" ValidationGroup="newItem" ForeColor="Red" ValidationExpression="^([\S\s]{1,100})$" />
                                            </div>
                                        </div>
                                    	<div class="form-group">
                                        	<label class="col-lg-4 control-label">Vacation Length</label>
                                            <div class="col-lg-8">
                                                <asp:TextBox CssClass="form-control" placeholder="Vacation Length" ID="txtVacationLength" ValidationGroup="newItem" runat="server" TabIndex="2" />
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="txtVacationLength" runat="server" Text="*" ValidationGroup="newItem" ForeColor="Red" />
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" Display="Dynamic" ValidationExpression="^[0-9]{1,7}$" ValidationGroup="newItem" ControlToValidate="txtVacationLength" runat="server" Text="Must be a number" ForeColor="Red" />
                                            </div>
                                        </div>
                                        <div class="form-group">
                                        	<label class="col-lg-4 control-label">Cost</label>
                                            <div class="col-lg-8">
                                                <asp:TextBox CssClass="form-control" placeholder="Cost" ID="txtCost" ValidationGroup="newItem" runat="server" TabIndex="3" />
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtCost" runat="server" Text="*" ValidationGroup="newItem" ForeColor="Red" />
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" Display="Dynamic" ValidationExpression="^\d+(\.\d\d)?$" ValidationGroup="newItem" ControlToValidate="txtCost" runat="server" Text="Must be a number" ForeColor="Red" />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="button_group">
                                    <asp:Button CssClass="btn btn-success" ID="btnSave"  ValidationGroup="newItem" Text="Save" runat="server" OnClick="btnSave_Click" />
                                    <asp:Button CssClass="btn btn-info" ID="btnCancel" Text="Cancel" runat="server" OnClientClick="$('#divDialog').dialog('close'); return false;" />                                    
                                </div> 
                            </div>
                        </fieldset>
                    </div>
                </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="btnSave" />
                    </Triggers>
                </asp:UpdatePanel>
            </div>

</asp:Content>
